<?php
MYTCONN();
$RSGET = '';
$GET = $GLOBALS['MYT']->db_array("SELECT ablID AS O_ID, ablName AS COL1, ablDateStart AS COL2, ablDateEnd AS COL3, ablFlag AS COL4, '' AS COL5, '' COL6, '' AS COL7, '' AS COL8
  			FROM hd_amlblacklist");
$CARD = $GET[0];

for ($i = 1; $i <= $CARD; $i++) {
    $RSGET .= "[{$i},'{$GET[$i]['O_ID']}','{$GET[$i]['COL1']}','{$GET[$i]['COL2']}','{$GET[$i]['COL3']}','{$GET[$i]['COL4']}','{$GET[$i]['COL5']}','{$GET[$i]['COL6']}','{$GET[$i]['COL7']}','{$GET[$i]['COL8']}']";
    if ($i < $CARD) {
        $RSGET .= ',';
    }
}
?>
<div class="title">Listas Negras Configuradas</div>
<div id="proms"></div>
<script charset="utf-8" type="text/javascript">
    disableSelection(document.getElementById("proms"));

    Ext.onReady(function(){

        var myData = [<?php echo $RSGET; ?>];

        var ds = new Ext.data.Store({
            reader: new Ext.data.ArrayReader({}, [
                {name: 'id'},
                {name: 'O_ID', type: 'int'},
                {name: 'COL1', type: 'string'},
                {name: 'COL2', type: 'string'},
                {name: 'COL3', type: 'string'},
                {name: 'COL4', type: 'string'},
                {name: 'COL5', type: 'string'},
                {name: 'COL6', type: 'string'},
                {name: 'COL7', type: 'string'},
                {name: 'COL8', type: 'string'}
            ])
        });
        ds.loadData(myData);
        var colModel = new Ext.grid.ColumnModel([
            {header: "ID", width: 40, sortable: true, locked:true, dataIndex: 'id'},
            {header: "ID", width: 40, sortable: true, locked:true, dataIndex: 'O_ID'},
            {header: "Lista", width: 200, sortable: true, locked:true, dataIndex: 'COL1'},
            {header: "Inicio", width: 120, sortable: true, locked:true, dataIndex: 'COL2'},
            {header: "Fim", width: 120, sortable: true, locked:true, dataIndex: 'COL3'},
            {header: "Estado", width: 140, sortable: true, dataIndex: 'COL4'},
            {header: "Actualizacao", width: 200, sortable: true, locked:true,dataIndex: 'COL5'},
            {header: "Tipo de Actualizacao", width: 80, sortable: true, locked:true, dataIndex: 'COL6'},
            {header: "Utilizado", width: 80, sortable: true, dataIndex: 'COL7'},
            {header: "", width: 80, sortable: true, locked:true,dataIndex: 'COL8'}
        ]);

        var selmode = new Ext.grid.RowSelectionModel({});
        var Console = new Ext.grid.GridPanel({
            ds: ds,
            cm: colModel,
            sm: selmode,
            height: 300,
            renderTo: 'proms'
        });

    });
</script>